<%@page import="org.hibernate.criterion.Restrictions"%>
<%@page import="org.hibernate.Criteria" import="org.hibernate.*"%>
<%@ page language="java" import="java.util.*" import="com.AO.DAO.*"
	pageEncoding="utf8"%>
<%
	String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE html>
<!-- saved from url=(0026)http://foodfood/ -->
<html class="">
<style type="text/css" id="__se_success_css_wb_ccc__"></style>
<head>

<title>下厨房</title>

<link href="./files/favicon.ico" rel="shortcut icon" type="image/x-icon">


<link href="./files/base.d706c3c6.compress.css" rel="stylesheet"
	type="text/css">


<script type="text/javascript" src="Js/jquery-2.1.4.min.js"></script>
<link href="./files/homepage.3a46be69.compress.css" rel="stylesheet"
	type="text/css">





<script type="text/javascript" src="./files/m.js"></script>

<style type="text/css"></style>
<script type="text/javascript">
  	function logout()
  	{
  		$.post("<%=basePath%>logout.action", {}, function(data) {
			//window.alert("返回值"+data.result);
			if (data.result = "0") {
				location.href = "index.jsp";
			} else {
				//alert(data.result);
			}
		}, "json");

	}
</script>

</head>



<body style="">



	<div class="popup-layer">


		<div class="reveal-modal-bg"></div>



		<div class="reveal-modal large normal-font" id="feedbackModal">

			<div class="reveal-modal-title-bar">
				<div class="reveal-modal-title">意见反馈</div>
				<a href="javascript:void(0)" class="close-reveal-modal"
					rel="nofollow"></a>
			</div>
			<div class="reveal-modal-main">


				<form action="http://foodfood/feedback/create/" method="POST">
					<textarea name="feedback" rows="3"></textarea>
					<input type="hidden" name="xf" value="None"> <input
						type="submit" value="提交" class="button">
				</form>


			</div>

		</div>


	</div>

	<div class="topbar-outer">
		<div class="topbar-container">
			<div class="topbar">




				<div class="pure-g">
					<div class="pure-u-1-6">
						<a href="/foodfood/AOHomePage..action" class="logo"></a>
					</div>
					<div class="pure-u-5-6">
						<div class="pure-g">
							<div class="pure-u-11-24">
								<form class="search" action="/foodfood/Search.action">
									<input type="text" name="keyword" class="typeahead float-left"
										data-default-text="" value="" placeholder="菜谱、食材"> <input
										type="hidden" name="type" value="fmf"> <input
										type="submit" value="搜索" class="button float-left">
								</form>
							</div>
							<div class="pure-u-1-3">
								<ul class="site-nav plain pure-g">
									<li class="pure-u"><a href="/foodfood/AOHomePage..action"
										data-ga-event="公共页面/导航栏/$text">首页</a>
									</li>
									<li class="topbar-cats pure-u"><a
										href="/foodfood/AOMenu..action" class="block-link"
										data-ga-event="公共页面/导航栏/$text"><span>菜谱分类</span> </a> <%
 	MaterialFoodTypesDAO dao=new MaterialFoodTypesDAO();
 							FoodTypesDAO daof=new FoodTypesDAO();
 							List<MaterialFoodTypes>list=dao.findByMaterialFoodTypeLevel(1);
 							List<FoodTypes>listf=daof.findByFoodTypeLevel(1); 
 							MaterialFoodOfSeasonDAO dao5=new MaterialFoodOfSeasonDAO();
 							List<MaterialFoodOfSeason>list5=dao5.findAll();
 %>
										<div class="topbar-cats-submenu hidden">
											<div class="topbar-cats-submenu-bg">

												<ul class="plain">
													<li class="topbar-cat-head">常用主题</li>
													<% int k=0;for(FoodTypes ft:listf)
								                    {if(k++==8)break;%>
													<li><a
														href="/foodfood/AOFoodMenu.<%=ft.getFoodTypeId() %>.action"
														title="<%=ft.getFoodTypeName() %>菜谱大全"
														data-ga-event="公共页面/导航栏/$text"><%=ft.getFoodTypeName() %></a>
													</li>
													<%} %>
												</ul>
												<ul class="plain">
													<li class="topbar-cat-head">常见食材</li>
													<% k=0;for(MaterialFoodTypes ft:list)
								                    {if(k++==8)break;%>
													<li><a
														href="/foodfood/AOMfoodMenu.<%=ft.getMaterialFoodTypeId() %>.action"
														title="<%=ft.getMaterialFoodTypeName() %>做法大全"
														data-ga-event="公共页面/导航栏/$text"><%=ft.getMaterialFoodTypeName() %></a>
													</li>
													<%} %>
												</ul>
												<ul class="plain">
													<li class="topbar-cat-head">时令食材</li>
													<%
														k=0;for(MaterialFoodOfSeason mfos:list5)						    
																				               {if(k++==8)break;
													%>
													<li><a
														href="/foodfood/AOMfood.<%=mfos.getMaterialFood().getMaterialFoodId()%>.action"
														title="<%=mfos.getMaterialFood().getMaterialFoodName()%>做法大全"
														data-ga-event="公共页面/导航栏/$text"><%=mfos.getMaterialFood().getMaterialFoodName()%></a>
														<%
															}
														%>
													
												</ul>
												<div class="topbar-cats-submenu-bottom">
													<a href="/foodfood/AOMenu..action"
														data-ga-event="公共页面/导航栏/$text">查看全部分类</a>
												</div>

											</div>
										</div></li>
									<li class="pure-u"><a
										href="/foodfood/AOFoodInMenuList..action"
										data-ga-event="公共页面/导航栏/$text">菜单</a>
									</li>

								</ul>
							</div>
							<div class="pure-u-5-24 clearfix">

								 <div class="user-action">
						              <%
											String account = (String)session.getAttribute("account");
											String nickname = (String)session.getAttribute("nickname");
										    	
							              	if(nickname!=null)
							           		{
										%>
										<a href="/foodfood/AOCooker.<%=account%>.action"><%=nickname%></a>
										<a onclick="logout()" href="index.jsp">退出</a>
										<%
											}
							               	else
							               	{
										%>
										<a href="register.jsp" data-ga-event="公共页面/导航栏/$text">注册</a> <a
											href="login.jsp" data-ga-event="公共页面/导航栏/$text">登录</a>&nbsp;&nbsp;
										<%
											}
										%>
						
						          </div>
							</div>
						</div>
					</div>
				</div>


			</div>
		</div>
	</div>


	<div class="page-outer">

		<div class="page-container">


			<div class="homepage-slogan align-center">
				<h2>唯有美食与爱不可辜负</h2>
				<p>
					<a href="/foodfood/AOHomePage..action" target="_blank"
						rel="nofollow">下厨房</a>
				</p>
			</div>

			<div class="pure-g">
				<div class="pure-u-2-3 main-panel">
					<div class="pure-g">

						<div class="pure-u-1-4 left-panel">





							<ul class="plain homepage-cats">
								<%
									int i=-1;
														  for(MaterialFoodTypes ft:list)
														  {
														  if(ft.getMaterialFoodTypeses().size()==0)
														  {
														  out.print(
														  "<li  class=\"hompage-cat-has-submenu homepage-cat"+String.valueOf(++i)+"\">"
														    +
														    "<a  data-ga-event=\"首页/菜谱分类/$text\"  class=\"homepage-cat-name\"  href=\"/foodfood/AOMfoodMenu."+ft.getMaterialFoodTypeId()+".action\">"
														      +"<i  class=\"cat-icon\" style=\"background-size:100% 100%;background-image:url("+ft.getImg()+")\"></i>"
														      +"<span  class=\"cat-name\">"+ft.getMaterialFoodTypeName()+"</span>"
														    +"</a>"

														  +"</li>");
														  }
														  else
														  {
														  String str="";
														  for(MaterialFoodTypes fts:ft.getMaterialFoodTypeses())
														  {
														       String strFoods="";
														       Set<MfoodMfoodTypesRelation> set=fts.getMfoodMfoodTypesRelations();
														       for(MfoodMfoodTypesRelation fftr:set)
														       {
														           strFoods+="<span  class=\"pure-u-1-4\"><a  href=\"/foodfood/AOMfood."+fftr.getMaterialFood().getMaterialFoodId()+".action\">"+fftr.getMaterialFood().getMaterialFoodName()+"</a></span>";
														       }
														         str+="<div  class=\"submenu-item bottom-line clearfix pure-g\">"          
														              +"<div  class=\"title pure-u-1-4\">"
														                +"<a  href=\"/foodfood/AOMfoodMenu."+fts.getMaterialFoodTypeId()+".action\">"+fts.getMaterialFoodTypeName()+"</a>"
														              +"</div>"
														              +"<div  class=\"body pure-u-3-4 pure-g\">"
														              +strFoods
														             +"</div>"       
														          +"</div>";
														  }
														  out.print(
														    "<li  class=\"hompage-cat-has-submenu homepage-cat"+String.valueOf(++i)+"\">"
														    +
														    "<a  data-ga-event=\"首页/菜谱分类/$text\"  class=\"homepage-cat-name\"  href=\"/foodfood/AOMfoodMenu."+ft.getMaterialFoodTypeId()+".action\">"
														      +"<i  class=\"cat-icon\"style=\"background-size:100% 100%;background-image:url("+ft.getImg()+")\"></i>"
														      +"<span  class=\"cat-name\">"+ft.getMaterialFoodTypeName()+"</span>"
														        +"<i  class=\"icon icon-cat-arrow\"></i>"
														    +"</a>"   
														    +"<div  class=\"homepage-cat-submenu hidden\"  style=\"display: none;\">"
														    +str
														    +"</div>"
														  +"</li>"
														  );
														}  
														  }
								%>
								<%
									for(FoodTypes ft:listf)
														  {
														  if(ft.getFoodTypeses().size()==0)
														  {
														  out.print(
														  "<li  class=\"hompage-cat-has-submenu homepage-cat"+String.valueOf(++i)+"\">"
														    +
														    "<a  data-ga-event=\"首页/菜谱分类/$text\"  class=\"homepage-cat-name\"  href=\"/foodfood/AOFoodMenu."+ft.getFoodTypeId()+".action\">"
														      +"<i  class=\"cat-icon\"style=\"background-size:100% 100%;background-image:url("+ft.getImg()+")\"></i>"
														      +"<span  class=\"cat-name\">"+ft.getFoodTypeName()+"</span>"
														    +"</a>"

														  +"</li>");
														  }
														  else
														  {
														  String str="";
														  for(FoodTypes fts:ft.getFoodTypeses())
														  {
														       String strFoods="";
														       Set<FoodFoodTypesRelation> set=fts.getFoodFoodTypesRelations();
														       for(FoodFoodTypesRelation fftr:set)
														       {
														           strFoods+="<span  class=\"pure-u-1-4\"><a  href=\"/foodfood/AOFood."+fftr.getFood().getFoodId()+".action\">"+fftr.getFood().getFoodName()+"</a></span>";
														       }
														         str+="<div  class=\"submenu-item bottom-line clearfix pure-g\">"          
														              +"<div  class=\"title pure-u-1-4\">"
														                +"<a  href=\"/foodfood/AOFoodMenu."+fts.getFoodTypeId()+".action\">"+fts.getFoodTypeName()+"</a>"
														              +"</div>"
														              +"<div  class=\"body pure-u-3-4 pure-g\">"
														              +strFoods
														             +"</div>"       
														          +"</div>";
														  }
														  out.print(
														    "<li  class=\"hompage-cat-has-submenu homepage-cat"+String.valueOf(++i)+"\">"
														    +
														    "<a  data-ga-event=\"首页/菜谱分类/$text\"  class=\"homepage-cat-name\"  href=\"/foodfood/AOFoodMenu."+ft.getFoodTypeId()+".action\">"
														      +"<i  class=\"cat-icon\"style=\"background-size:100% 100%;background-image:url("+ft.getImg()+")\"></i>"
														      +"<span  class=\"cat-name\">"+ft.getFoodTypeName()+"</span>"
														        +"<i  class=\"icon icon-cat-arrow\"></i>"
														    +"</a>"   
														    +"<div  class=\"homepage-cat-submenu hidden\"  style=\"display: none;\">"
														    +str
														    +"</div>"
														  +"</li>"
														  );
														}   
														  }
								%>
							</ul>


							<a href="/foodfood/AOMenu..action" data-ga-event="首页/菜谱分类/$text">全部菜谱分类</a>
						</div>



						<div class="pure-u-3-4">



							<div class="headline">
								<div class="unslider headline-slider has-dots"
									style="width: 505px; height: 230px; overflow: hidden;">
									<ul class="plain"
										style="position: relative; left: 0%; width: 500%; height: 230px;">
										<% 
									       FoodRecommendedDailyDAO dao1=new FoodRecommendedDailyDAO();
									       List<FoodRecommendedDaily> list1= dao1.findAll();
									       for(FoodRecommendedDaily frd:list1)
									       {%>
										<li class="pure-g headline-recipe active"
											style="float: left; width: 20%;">
											<div class="pure-u-1-2 cover">
												<a
													href="/foodfood/AOFood.<%=frd.getFood().getFoodId()%>.action"
													class="image-link"> <img
													src="<%=frd.getFood().getImg()%>"
													alt="<%=frd.getFood().getFoodName()%>" width="240"
													height="230"> </a>
											</div>
											<div class="pure-u-1-2">
												<div class="detail">
													<div class="name ellipsis">
														<a
															href="/foodfood/AOFood.<%=frd.getFood().getFoodId()%>.action"><%=frd.getFood().getFoodName()%></a>
													</div>
													<div class="stats">
														<span class="num">1</span>人做过这道菜
													</div>
													<div class="desc">
														<%=frd.getDescription()%><br> <a
															href="/foodfood/AOCooker.<%=frd.getFood().getUser().getAccount()%>.action"><%=frd.getFood().getUser().getNickName()%></a>
													</div>
												</div>
											</div></li>
										<%}%>
									</ul>
									<a class="history-headline-link icon"
										href="/foodfood/AOFoodList..action"></a>
								</div>
							</div>


							<div class="rising-recipes block">
								<div class="title-bar">
									<h3 class="title">新秀菜谱</h3>
									<div class="left-action">
										<a href="/foodfood/AOFoodList..action">全部</a>
									</div>
									<div class="right-action">
										<a href="javascript:void(0)"
											class="icon left-arrow left-arrow-disable">&gt;</a><a
											href="javascript:void(0)" class="icon right-arrow">&gt;</a>
									</div>
								</div>
								<div class="unslider rising-recipes-slider"
									style="width: 465px; height: 87px; overflow: hidden;">
									<ul class="plain"
										style="position: relative; left: 0px; width: 500%;">
										<%
										Query q=dao.getSession().createSQLQuery("select * from food order by create_datetime desc");  
		                                List<Object[]> li=(List<Object[]>)q.list();
										for(i=0;i<=li.size()%5;i++)
										{if(i==3){break;}%>
										<li class="active" style="float: left; width: 20%;">
											<ul class="page-of-recipes">
												<% for(int j=0;j<5;j++){
											if(i*5+j<li.size()){%>
												<li>

													<div class="recipe-80-vertical">
														<div class="cover">
															<a href="/foodfood/AOFood.<%=li.get(i*5+j)[0]%>.action"
																title="<%=li.get(i*5+j)[1]%>" class="image-link"> <img
																class="image-link"> <img
																src="<%=li.get(i*5+j)[4]%>" alt="<%=li.get(i*5+j)[1]%>"
																width="80" height="60"> </a>
														</div>
														<div class="name">
															<a href="/foodfood/AOFood.<%=li.get(i*5+j)[0]%>.action"
																title="<%=li.get(i*5+j)[1]%>"><span class="ellipsis"><%=li.get(i*5+j)[1]%></span>
															</a>
														</div>
													</div>
												</li>
												<%} }%>
											</ul>
										</li>
										<%}%>
									</ul>
								</div>
							</div>


							<div class="pop-recipes block">
								<div class="title-bar">
									<h3 class="title">最受欢迎</h3>
									<div class="left-action">
										<a href="/foodfood/AOFoodList..action">全部</a>
									</div>
								</div>
								<ul class="plain">
									<%
										q=dao.getSession().createSQLQuery("select * from food order by zan desc");  
		                                li=(List<Object[]>)q.list();
										for(i=0;i<li.size();i++)
										{if(i==9){break;}%>
									<li>
										<div class="recipe-140-vertical">
											<div class="cover">
												<a href="/foodfood/AOFood.<%=li.get(i)[0]%>.action"
													title="<%=li.get(i)[1]+"--"+li.get(i)[5] %>"
													class="image-link" data-ga-event="首页/流行菜谱/第<%=i %>个"> <img
													src="<%=li.get(i)[4] %>"
													alt="<%=li.get(i)[1]+"--"+li.get(i)[5] %>" width="140"
													height="106"> </a>
											</div>
											<div class="name">
												<a href="/foodfood/AOFood.<%=li.get(i)[0]%>.action"
													title="<%=li.get(i)[1]+"--"+li.get(i)[5] %>"
													data-ga-event="首页/流行菜谱/第<%=i %>个"><span
													class="ellipsis"><%=li.get(i)[1]+"--"+li.get(i)[5] %></span>
												</a>
											</div>
											<div class="stats">
												<%Query qUser=dao.getSession().createSQLQuery("select nick_name from user where account='"+li.get(i)[3]+"'");  
		                                      List<String> liUser=(List<String>)qUser.list(); %>
												<a href="/foodfood/AOCooker.<%=li.get(i)[3]%>.action"
													class="gray-link ellipsis"><%=liUser.get(0)%></a>
												&nbsp;&nbsp;&nbsp;&nbsp;<span>14&nbsp;做过</span>
											</div>
										</div>
									</li>
									<%} %>
								</ul>
							</div>


							<div class="pop-ings block">
								<div class="title-bar">
									<h3 class="title">时令食材</h3>
									<div class="left-action">
										<a href="/foodfood/AOMenu..action">全部</a>
									</div>
								</div>
								<div class="pop-ings-bg">
									<ul class="plain">
										<%
											i=0;		
																	for(MaterialFoodOfSeason mfos:list5)						    
																	{
																	if(i==12)
																	break;
										%>
										<li style="width:70px;height:92px;"><a
											href="/foodfood/AOMfood.<%=mfos.getMaterialFood().getMaterialFoodId()%>.action"
											class="image-link"><img
												src="<%=mfos.getMaterialFood().getImg()%>"
												alt="<%=mfos.getMaterialFood().getMaterialFoodName()%>"
												width="60" height="60"><br> <span class="name"><%=mfos.getMaterialFood().getMaterialFoodName()%></span>
										</a></li>
										<%
											}
										%>
									</ul>
								</div>
							</div>


						</div>

					</div>




				</div>


				<div class="pure-u-1-3 right-panel">

					<%
						if(account ==null)
						{
					%>
					<div class="user-info">

						<div class="login">
							<ul class="plain">
								<li><a href="http://foodfood/social/?connect_type=qzone"
									class="button small-button"><i
										class="login-icon login-icon-qq"></i>QQ 登录</a>
								</li>
								<li><a href="http://foodfood/social/?connect_type=weibo"
									class="button small-button"><i
										class="login-icon login-icon-weibo"></i>微博登录</a>
								</li>
								<li><a href="http://foodfood/social/?connect_type=douban"
									class="button small-button"><i
										class="login-icon login-icon-douban"></i>豆瓣登录</a>
								</li>
							</ul>
							<br> <a href="login.jsp">邮箱登录</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a
								href="register.jsp">注册</a>
						</div>
					</div>
					<%
							}
							else
							{
								//String account = (String)request.getAttribute("CookerAccount");
								request.removeAttribute("CookerAccount");
								UserDAO userDao = new UserDAO();
								User user = (User)userDao.findByProperty("account", account).get(0);
								
								FoodDAO foodDao = new FoodDAO();
								Criteria criteria = HibernateSessionFactory.getSession().createCriteria(Food.class);
								criteria.add(Restrictions.eq("user.account", account));
								List foods = criteria.list();
						%>

					<div class="user-info">
						<div class="avatar">
							<a href="/foodfood/AOCooker.<%=user.getAccount()%>.action"
								class="image-link"> <img src="<%=user.getImg() %>"
								alt="<%=user.getNickName() %>的厨房" width="60" height="60">
							</a>
						</div>
						<div class="name">
							<a href="/foodfood/AOCooker.<%=user.getAccount()%>.action"><%=user.getNickName()%>的厨房</a>
						</div>
						<div class="stats">
							0 收藏 &nbsp;&nbsp;|&nbsp;&nbsp; <%=user.getFoods().size() %>作品 &nbsp;&nbsp;|&nbsp;&nbsp;<%=user.getFoodMenus().size() %> 菜谱
						</div>
						<div class="action">
							<a href="create.jsp" class="button small-button">+ 创建菜谱</a>
						</div>

					</div>
					<%
						}
					%>
					<!-- end of user info -->



					<div class="pop-keywords"></div>




					<div class="pop-recipe-lists">
						<div class="block block-has-padding white-bg">
							<div class="title-bar">
								<div class="title">流行菜单</div>
								<div class="left-action">
									<a href="/foodfood/AOFoodInMenuList..action">全部</a>
								</div>
							</div>
							<ul class="list">
								<%FoodMenuDAO dao7=new FoodMenuDAO();
                               List<FoodMenu> list7=dao7.findAll();
                               i=0;
                               for(FoodMenu fm:list7)
                               {
                                 if(i++==9)
                                 break;
                             %>
								<li><a
									href="/foodfood/AOFoodInMenu.<%=fm.getMenuId() %>.action"><span
										class="ellipsis"><%=fm.getMenuName() %></span> </a></li>
								<%} %>
							</ul>
						</div>
					</div>



					<div class="recommended-cookers">
						<div class="block block-has-padding white-bg">
							<div class="title-bar">
								<h3 class="title">下厨房的厨友们</h3>
								<div class="left-action">
									<a href="/foodfood/AOCookerList..action">更多</a>
								</div>
							</div>
							<div class="content white-bg">
								<ul class="plain">
									<%UserDAO dao8=new UserDAO();
								  List<User> set8=dao8.findAll();
								  i=0;
								  for(User user:set8)
								  {if(i++==8){break;}%>
									<li class="has-bottom-border">

										<div class="cook-follow">

											<div class="avatar">
												<a href="/foodfood/AOCooker.<%=user.getAccount() %>.action"
													class="image-link"> <img src="<%=user.getImg() %>"
													data-src="<%=user.getImg() %>"
													alt="<%=user.getNickName() %>" width="60" height="60">
												</a>
											</div>
											<div class="detail">
												<div class="name">
													<a href="/foodfood/AOCooker.<%=user.getAccount()%>.action"><%=user.getNickName() %></a>
												</div>
												<div class="follows">591&nbsp;关注</div>
												<div class="stats"><%=user.getFoods().size() %>&nbsp;个作品
												</div>
											</div>

											<div class="action">
												<a class="button gray-button" href="/foodfood/login/">关注</a>
											</div>
										</div></li>
									<%}%>
								</ul>
								<div class="more">
									<a href="/foodfood/AOCookerList..action">查看更多</a>
								</div>
							</div>
						</div>
					</div>









				</div>

			</div>

		</div>

	</div>


	<div class="bottom-outer">
		<div class="bottom-container"></div>
	</div>





	<script type="text/javascript" src="./files/jquery.min.js"></script>
	<script src="http://y.inad.com/static/show_ads.js"></script>



	<script type="text/javascript"
		src="./files/2013.anonymous.0a0601dc.compress.js"></script>
	<img id="scrollTop" src="./images/scroll_top.png"
		style="opacity: 1; position: fixed; width: 50px; height: auto; z-index: 20; border: 0px; padding: 0px; bottom: 20px; right: 20px; margin: 0px; cursor: pointer; display: none;">


	<div id="color_timer"></div>





</body>
</html>